package com.ae.shield.client.events;

import com.ae.shield.ModLib;
import com.ae.shield.common.items.ItemIntegratedShield;
import com.ae.shield.common.items.ItemList;
import net.minecraft.item.ItemModelsProperties;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;

@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class ItemPropertyOverride {
    @SubscribeEvent
    public static void propertyOverride(FMLClientSetupEvent event) {
        event.enqueueWork(() -> {
            ItemModelsProperties.registerProperty(ItemList.SHIELD.get(), new ResourceLocation(ModLib.MOD_ID, "working"), (s, w, e) -> ((ItemIntegratedShield)s.getItem()).isWorking(s));
            ItemModelsProperties.registerProperty(ItemList.RENDER_ITEM.get(), new ResourceLocation(ModLib.MOD_ID, "count"), (s, w, e) -> (s.getCount()));
        });
    }
}
